package cz.boxdesign.library.web.decorator;

import org.displaytag.decorator.TableDecorator;

import cz.boxdesign.library.entity.Book;

public class BookTableDecorator extends TableDecorator {

  public String getEditUrl() {
    Book kniha = (Book) getCurrentRowObject();
    return "<a href=\"/isLibrary/books/edit.do?bookId=" + kniha.getId() + "\"><img src=\"/isLibrary/images/icons/edit_16.png\"/></a>";
  }

  public String getShowUrl() {
    Book kniha = (Book) getCurrentRowObject();
    return "<a href=\"/isLibrary/books/show.do?bookId=" + kniha.getId() + "\"><img src=\"/isLibrary/images/icons/goto_16.png\"/></a>";
  }

  public String getOddeleniLink() {
    Book kniha = (Book) getCurrentRowObject();
    return "<a href=\"/isLibrary/department/show.do?departmentId=" + kniha.getOddeleni().getId() + "\">" + kniha.getOddeleni().getNazev()
        + "</a>";
  }

  public String getNakladatelstviLink() {
    Book kniha = (Book) getCurrentRowObject();
    return "<a href=\"/isLibrary/publisher/show.do?publisherId=" + kniha.getNakladatelstvi().getId() + "\">"
        + kniha.getNakladatelstvi().getNazev() + "</a>";
  }

  public String getDeleteUrl() {
    Book a = (Book) getCurrentRowObject();
    return "<a href=\"javascript:openDialog('books/delete.do?bookId=" + a.getId()
        + "')\"><img src=\"/isLibrary/images/icons/delete_16.gif\"/></a>";
  }
  
  public String getGiveBackUrl(){
	  Book a = (Book) getCurrentRowObject();
	    return "<a href=\"javascript:giveBack('" + a.getId() + "')\">Return Book</a>";
  }
  
  public String getBorrowUrl(){
	  Book a = (Book) getCurrentRowObject();
	    return "<a href=\"javascript:borrow('" + a.getId() + "')\">Borrow Book</a>";
  }
  
  public String getDeleteReservationUrl(){
	  Book a = (Book) getCurrentRowObject();
	    return "<a href=\"javascript:deleteReservation('" + a.getId() + "')\">Delete Reservation</a>";
  }
  
  public String getMakeReservationUrl(){
	  Book a = (Book) getCurrentRowObject();
	    return "<a href=\"javascript:makeReservation('" + a.getId() + "')\">Make Reservation</a>";
  }
  
  public String getdeleteFromAuthorUrl(){
	  Book a = (Book) getCurrentRowObject();
	  return "<a href=\"javascript:createUrl('books/deleteFromAuthor.do?bookId=" + a.getId()
		        + "')\"><img src=\"/isLibrary/images/icons/delete_16.gif\"/></a>";
  }
}
